import { View } from "../../../mvc/core/View";
import { ObjCreate } from "../common/ObjCreate";
import { ImagesConst } from "../../resource/ImagesConst";
import { GTextFormat } from "../../../common/GTextFormat";
import { GTileList } from "../../../../com/mui/controls/GTileList";
import { ScrollBarDirection } from "../../../../fl/controls/ScrollBarDirection";
import { WarehouseGoodsRenderer } from "./WarehouseGoodsRenderer";
import { SelfGoodsRenderer } from "./SelfGoodsRenderer";
import { ShopGoodsRenderer } from "./ShopGoodsRenderer";
import { DataProvider } from "../../../../fl/data/DataProvider";
type int = number;
//class RunBusinessListPanel
    
    export  class RunBusinessListPanel extends View
    {
        constructor()
        {
            super();
            return;
        }

        public initPanel(arg1: Array<any>, arg2: int, arg3: int, arg4: int): void
        {
            this.createTitle(arg1);
            this.createTitleList(arg2, arg3, arg4);
            var loc1=ObjCreate.createBg(0, 25, arg3, 2, this, ImagesConst.SplitLine);
            return;
        }

        /* internal  */createTitle(arg1: Array<any>): void
        {
            var loc2=null;
            var loc1=new GTextFormat("", 12, 16777113);
            var loc3=0;
            while (loc3 < arg1.length) 
            {
                loc2 = new Object /* flash.text.TextField */();
                loc2.x = arg1[loc3].x;
                loc2.y = arg1[loc3].y;
                loc2.selectable = false;
                loc2.text = arg1[loc3].name;
                loc2.height = 25;
                loc2.width = loc2.textWidth + 10;
                loc2.setTextFormat(loc1);
                loc2.autoSize = flash.text.TextFieldAutoSize.LEFT;
                addChild(loc2);
                ++loc3;
            }
            return;
        }

        /* internal  */createTitleList(arg1: int, arg2: int, arg3: int): void
        {
            this._titleList = new GTileList();
            this._titleList.setSize(arg2, arg3);
            this._titleList.columnWidth = 230;
            this._titleList.rowHeight = 32;
            this._titleList.direction = ScrollBarDirection.VERTICAL;
            this._titleList.horizontalGap = 0;
            this._titleList.verticalGap = 0;
            this._titleList.width = arg2 + 15;
            this._titleList.height = arg3;
            this._titleList.styleName = "TileList";
            this._titleList.setStyle("skin", new Object /* flash.display.Bitmap */());
            if (arg1 != 1) 
            {
                if (arg1 != 2) 
                {
                    if (arg1 == 3) 
                    {
                        this._titleList.setStyle("cellRenderer", WarehouseGoodsRenderer);
                    }
                }
                else 
                {
                    this._titleList.setStyle("cellRenderer", SelfGoodsRenderer);
                }
            }
            else 
            {
                this._titleList.setStyle("cellRenderer", ShopGoodsRenderer);
            }
            this._titleList.move(0, 30);
            this._dataProvider = new DataProvider();
            this._titleList.dataProvider = this._dataProvider;
            addChild(this._titleList);
            return;
        }

        public updateDataProvider(arg1: Array<any>): void
        {
            var loc1=0;
            this._dataProvider.removeAll();
            if (!(arg1 == null) && arg1.length > 0) 
            {
                loc1 = 0;
                while (loc1 < arg1.length) 
                {
                    this._dataProvider.addItem(arg1[loc1]);
                    ++loc1;
                }
            }
            this._titleList.dataProvider = this._dataProvider;
            return;
        }

        /* internal */ /* var */_titleList: GTileList;

        /* internal */ /* var */_dataProvider: DataProvider;
    }
